#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main (int argc, char const* argv[])
{
    int k, i, n, t, ccode[128], pcode[128];
    char cstr[128], pstr[128];

    while (scanf("%d", &k) != EOF) {
        if (k == 0) break;

        scanf("%s", cstr);
        n = strlen(cstr);

        for (i = 0; i < n; i++) {
            if (cstr[i] >= 'a' && cstr[i] <= 'z') {
                ccode[i] = cstr[i] - 96;
            } else if (cstr[i] == '_') {
                ccode[i] = 0;
            } else {
                ccode[i] = 27;
            }
        }

        for (i = 0; i < n; i++) {
            t = (k * i) % n;
            pcode[t] = (ccode[i] + i) % 28;
        }

        for (i = 0; i < n; i++) {
            if (pcode[i] > 0 && pcode[i] < 27) {
                pstr[i] = pcode[i] + 96;
            } else if (pcode[i] == 0) {
                pstr[i] = '_';
            } else {
                pstr[i] = '.';
            }
        }

        for (i = 0; i < n; i++) {
            printf("%c", pstr[i]);
        }
        printf("\n");
    }

    return 0;
}
